import pandas as pd


def delete_duplicate(frame):
    # 方式一：判断是否为重复行
    print(frame.duplicated())  # 判断是否为重复行
    # 方式二：删除重复行，默认是所有的列判断
    frame.drop_duplicates(inplace=True)
    # 也可以指定行进行判断
    frame.drop_duplicates(['age'])  # 默认保留第一个重复值
    # 也可以保留最后一个重复值
    frame.drop_duplicates(["age"], keep='last', inplace=True)
    print(frame)


if __name__ == '__main__':
    data = {
        "name": ["小红", "小蓝", "小绿"],
        "age": [18, 18, 20],
        "height": [165, 175, 185],
        "framework": ["python", "java", "javaScript"]
    }
    frame = pd.DataFrame(data)
    delete_duplicate(frame)
